<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .first-com{
            background-color: red;
        }
    </style>
</head>

<body>
    <div id="div">   
        <first-com>
            <div class="test">
                <button @click="num++">点击{{num}}</button>
            </div>
        </first-com>

        <first-com>
            <a href="#">这是一个链接</a>
        </first-com>
    </div>

    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.3.4/axios.min.js"></script>

    <script>
        //app本生也是组件，根(root)组件
        const app = Vue.createApp({
            data(){
                return{
                    num:0,
                }
            }

        });
        app.component('FirstCom',{
            template:`
                <div class="first-com">
                    <slot></slot>
                </div>
            `,
        });

        app.mount('#div')

    </script>

</body>

</html>